var express = require('express');
var router = express.Router();

const db = require("../public/javascripts/db");

router.post('/', function(req, res, next) {
    let info = req.body;
    // console.log(info);
    let sql = "select * from owner where owner_tel = ? and owner_pass = ?";
    let data = [info.owner_tel,info.owner_pass]
    // console.log(data);

    db(sql,data,(result) =>{
        console.log(result);
        if(result.length > 0){
            res.json({
                code:200,
                message:"登录成功",
                data: result[0]
            })
        }else{
            res.json({
                code:201,
                message:"登录失败"
            })
        }
    })
});

module.exports = router;
